import QtQuick
import QtQuick.Controls

Item {
    id: root
    required property string iconName
    property int iconSize: 16
    property alias color: iconLabel.color
    implicitWidth: iconLabel.implicitWidth
    implicitHeight: iconLabel.implicitHeight

    onIconNameChanged: {
        const tmp = iconName.split(".");
        const iconFamily = tmp[0];
        const iconKey = tmp[1];
        iconLabel.font.family = IconFont.iconFamilies[iconFamily];
        iconLabel.text = IconFont.icons[iconFamily][iconKey];
    }
    Label {
        id: iconLabel
        verticalAlignment: Text.AlignVCenter
        horizontalAlignment: Text.AlignHCenter
        // anchors.fill: parent
        font.pixelSize: iconSize
    }
}
